package com.tencreat.service.mall;

import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.tencreat.common.core.domain.model.ReqStringParam;
import com.tencreat.common.enums.BalanceBusinessType;
import com.tencreat.common.enums.BalanceTypeEnum;
import com.tencreat.domain.account.AccountWithdrawAudit;
import com.tencreat.domain.account.AccountWithdrawInfo;
import com.tencreat.domain.mall.dto.CashIntegralPayDTO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author huang wei
 * @version 1.0
 * @date 2021/9/2 16:27
 * 支付方式业务
 */
public interface IPayService {

    /**
     * 传订单号
     * 返回签名
     * @param param
     * @param <T>
     *     @throws WxPayException
     * @return
     */
    <T> T createWxOrder(ReqStringParam param) throws WxPayException;


    /**
     * 微信组合支付传订单号
     * 返回签名
     * @param commons
     * @param <T>
     *     @throws WxPayException
     * @return
     */
    <T> T createWxOrders(List<String> commons,String tradeType) throws WxPayException;

    /**
     * 微信支付回调接口
     * @param xmlData
     * @return
     * @throws WxPayException
     */
    String parseWxOrderNotifyResult(String xmlData) throws WxPayException;

    void parseAliPayOrderNotifyResult(Map<String,String> map,Boolean flag);

    /**
     * 支付宝支付（证书）
     * @param param
     * @throws AlipayApiException
     */
    void createAliPayCertificateOrder(ReqStringParam param) throws AlipayApiException;

    /**
     * 支付宝支付（证书）多订单组合支付
     * @param commons
     * @throws AlipayApiException
     */
    void createAliPayCertificateOrders(List<String> commons) throws AlipayApiException;

    /**
     * 支付宝支付
     * @param param
     * @throws AlipayApiException
     */
    String createAliPayOrder(ReqStringParam param) throws AlipayApiException;


    /**
     * 描述信息  支付宝h5支付
     * @Author yaoruiqi
     * @Date: 2023/11/13 04:29
     */
    String createAliPayH5Order(ReqStringParam param);

    /**
     * 支付宝支付多订单组合支付
     * @param commons
     * @throws AlipayApiException
     */
    String createAliPayOrders(List<String> commons) throws AlipayApiException;

    /**
     * 支付宝退款接口
     * @param param
     * @return
     * @throws AlipayApiException
     */
    JSONObject alipayTradeRefund(ReqStringParam param) throws AlipayApiException;

    /**
     * 微信退款
     * @param param
     * @return
     */
    WxPayRefundResult refundWx(ReqStringParam param) throws WxPayException;

    /**
     * 消费券支付
     * @param id
     * @return
     */
    ConcurrentHashMap<String,Object> consumerRollPay(ReqStringParam id);

    /**
     * 现金积分支付
     * @param dto 订单入参
     */
   // void cashIntegralPay(CashIntegralPayDTO dto);

    /**
     * 购物积分支付
     * @param //dto 订单入参
     */
    //void shopIntegralPay(CashIntegralPayDTO dto);

    Object sxyBankPay(ReqStringParam param);

    JSONObject paymentBank(ReqStringParam param);

    void noticeSxy(String order, String chnltrxid) throws InterruptedException;

    Object adapayAlipayH5(ReqStringParam param) throws Exception;

    Object lianLianBankPay(ReqStringParam param);

    JSONObject behalf(AccountWithdrawInfo accountWithdrawInfo, AccountWithdrawAudit accountWithdrawAudit);

    boolean behalfLian(AccountWithdrawInfo accountWithdrawInfo, AccountWithdrawAudit accountWithdrawAudit);

    JSONObject sandPayCreateOrderBank(String orderSn);

    Map<String, String> sandPayNoticeBank(Map<String, String> map);

    Object sandGetKaptcha(ReqStringParam param);

    Object sandPay(ReqStringParam param);

    boolean sandBehalf(AccountWithdrawInfo accountWithdrawInfo, AccountWithdrawAudit accountWithdrawAudit);

    void sandBehalfQuery(AccountWithdrawAudit accountWithdrawAudit);

    Boolean sandPayStatus(String orderCode);
}
